import React, { Component } from "react";
import { Route, Switch, Redirect } from "react-router-dom";
import MyNavLink from "../../components/MyNavLink";
import News from "./News";
import Message from "./Message";
import "./home.css";

export default class Home extends Component {
  render() {
    return (
      <div className="home-content-box">
        <p>我是home内容</p>
        <ul className="navigation-box sidebar-box">
          <li>
            <MyNavLink to="/home/news" children="news"/>
          </li>
          <li>
            <MyNavLink to="/home/message" children="message"/>
          </li>
        </ul>
        <div className="home-route-box">
          {/* 注册路由 */}
          <Switch>
            <Route path="/home/news" component={News}></Route>
            <Route path="/home/message" component={Message}></Route>
            <Redirect to="/home/message"></Redirect>
          </Switch>
        </div>
      </div>
    );
  }
}
